package pay.commont;

public enum MessageBindingType {
    ORDER(0, "订单"),
    CLUB(1, "俱乐部"),
    FEEDBACK(2, "反馈"),
    MANAGE_GAME(3, "管理端审核信息"),
    REGISTRATION(4, "报名通知");

    private final int code;
    private final String desc;

    MessageBindingType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据 code 获取对应的枚举值
     */
    public static MessageBindingType getByCode(int code) {
        for (MessageBindingType type : values()) {
            if (type.code == code) {
                return type;
            }
        }
        return null;
    }

    /**
     * 根据 desc 获取对应的枚举值
     */
    public static MessageBindingType getByDesc(String desc) {
        for (MessageBindingType type : values()) {
            if (type.desc.equals(desc)) {
                return type;
            }
        }
        return null;
    }
}